package beanstao.util.response;

import beanstao.util.Strings;
import beanstao.util.json.JsonLib;

public class StringData extends PD
{
	private StringData()
	{
	}

	static StringData ME(String str)
	{
		StringData data = new StringData();
		data._responseData = str;
		return data;
	}

	@Override
	public String toJson()
	{
		if (null == _responseData)
		{
			this.logWarn("Response数据为空。");
			return null;
		}
		String value = String.valueOf(_responseData);
		if (Strings.isQuoteBy(value, '[', ']') || Strings.isQuoteBy(value, '{', '}'))
			return value;
		return JsonLib.fromObject(_responseData);
	}
}
